{extend name="public/base"/}
{block name="body"}
<div class="main-box no-header clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>{$meta_title}</h2>
		</div>
		<div class="pull-right">
			<!-- <a href="{:url('add')}" class="btn btn-primary pull-right"> <i class="fa fa-plus-circle fa-lg"></i> 新增</a> -->
		</div>
	</header>
	<div class="main-box-body clearfix">
		<div class="table-responsive">

      <table class="table table-striped">
          <tbody>
              <tr>
                  <td class="info col-lg-2 text-right">订单编号</td>
                  <td class="col-lg-10 text-left">
                      {$info.out_trade_no}
                  </td>
              </tr>
              <tr>
                  <td class="info col-lg-2 text-right">购买商品</td>
                  <td class="col-lg-10 text-left">
                      <table class="table">
                        <thead>
                          <tr>
                            <th width="60px">商品id</th>
                            <th>封面图</th>
                            <th>商品名称</th>
                            <th>规格名称</th>
                            <th>单 价</th>
                            <th>代理价</th>
                            <th>数 量</th>
                            <th>总 价</th>
                          </tr>
                        </thead>
                          {volist name="shoplist" id="vo"}
                          <tr>
														<td>{$vo.good_id}</td>
														<td><img src="{$vo['good_id']|get_table_field='id','cover_id','Goods'|get_cover='path'}" width="96" height="50" /></td>
														<td>{$vo['good_name']}</td>
														<td>{$vo['rule_name']}</td>
														<td>{$vo['price']}</td>
														<td>{$vo['price1']}</td>
														<td>{$vo['num']}</td>
														<td>{$vo['num']*$vo['price']}</td>
													</tr>
                          {/volist}
                      </table>
                  </td>
              </tr>
              <tr>
                  <td class="info col-lg-2 text-right">订单信息</td>
                  <td class="col-lg-10 text-left">

                      <p>
                      商品总价格：{$info.shop_price}元 ， 运费：{$info.freight}元 ， 运费补贴：{$info.subsidy}元  ， 余额：{$info.balance}元，  优惠券：{$info.coupon_price}元 ，余额和优惠券合计： {$info.balance +$info.coupon_price}元 ,打包费用：{$info.pack_price}{$info.pay_zk ? '，第二天折扣:'.$info.pay_zk : ''}，实付：{$info.pay_price}元 订单金额：{$info.total}元


                      </p>
                      <p> 微信昵称：{$info.nick_name} </p>
                      <p> 收货人姓名：{$info.user_name} </p>
                      <p>发货地址：{$info.place_id|get_table_field="id","name","place"}</p>
                      <p>收货地址：{$info.address}</p>
                      <p>距离：{eq name="$info.place_id"} {else /}{$info.disparity}公里{/eq}</p>
                      <p>收货电话：{$info.tel}</p>
                      <p>下单时间：{$info.create_time}</p>
                      <p>订单类型：
												 {eq name="$info.index_type" value="1"} 团购{/eq}
									       {eq name="$info.index_type" value="0"}及时配送{/eq}
												  {eq name="$info.index_type" value="2"} 包邮{/eq}
											 </p>
                      <p>送达时间：{$info.deliverytime}</p>
                      <p>送货方式：{$info['way']|parse_config_value='distribution'}</p>
											{eq name="$info.way" value="1"}
											<p>送货师傅：{$info['allot_person']|get_table_field="id","name","delivery_person"}   （电话：{$info['allot_person']|get_table_field="id","tel","delivery_person"}）</p>
											{/eq}
											{eq name="$info.way" value="2"}
											<p>自提地点：{$info['zt_address']}</p>
											<p>发货站：{$info['zt_address']|get_table_field="name","subname","delivery_arayacak"}</p>
											<p>自提站长：{$info['zt_address']|get_table_field="name","username","delivery_arayacak"},电话：{$info['zt_address']|get_table_field="name","phone","delivery_arayacak"}</p>
											{/eq}
                      <p>支付方式：{$info['pay']|parse_config_value='pay'}</p>
                      <p>返利用户：{$info['rebate_code']|get_table_field="uid","username","member"}</p>
                      <p>备注:<textarea class="form-control" id="remark" name="remark" data-id="{$info['id']}">{$info['remark']}</textarea>
												</p>
                      <p>{$info['offlinepay_status']? '（实体扫码）' : ''}</p>
                  </td>
              </tr>
          </tbody>
      </table>

			<!--startprint-->


			<!--endprint-->
			<div class="pull-right">
				<a href="{:url('prints', ['id'=>$info['id']])}" target="_blank"  class="btn btn-primary pull-right">打印订单 </a>
			</div>

			<div class="pull-right" style="margin-right:20px;">
				<a href="{:url('simpleprints', ['id'=>$info['id']])}" target="_blank"  class="btn btn-primary pull-right">简易打印订单</a>
			</div>
    </div>
	</div>
</div>
<script type="text/javascript">

$(function(){
	$("#remark").mouseleave(function(){
		var val =   $("#remark").val()
		var orderid =  $(this).attr('data-id');
		$.post("{:url('order/editOrderInfo')}", {'id': orderid, 'remark': val}, function(data) {

			if(data.code == 1){
				alert(data.msg)
			}

		}, "json");
	});
})

function doPrint() {
					$('body').attr('style', 'padding: 0;');
					$('.table td').attr('style', 'font-size: 12px;');
					$('title').text('打印订单详情')
					bdhtml = window.document.body.innerHTML;
					sprnstr = "<!--startprint-->";
					eprnstr = "<!--endprint-->";
					prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
					prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
					window.document.body.innerHTML = prnhtml;
					window.print();
				}
</script>

{/block}
